<?php


namespace App\Http\Controllers\Admin;


use App\Http\Requests\Admin\System\SettingFormRequest;
use App\Repositories\SettingRepository;
use Illuminate\Contracts\View\Factory;
use Illuminate\View\View;

class SettingController extends BaseController
{
    /**
     * 仓储类
     * @var SettingRepository
     */
    private $rep;

    /**
     * 构造方法
     * @param SettingRepository $rep
     */
    function __construct(SettingRepository $rep)
    {
        $this->rep = $rep;
        $this->set('setting', 'setting');
    }

    /**
     * 首页
     * @return Factory|View
     */
    function index()
    {
        return $this->view('index');
    }

    /**
     * 保存
     * @param SettingFormRequest $request
     * @return mixed
     */
    function save(SettingFormRequest $request)
    {
        $data = $request->all();
        return $this->rep->save($data);
    }
}
